package com.toubutu.audio.dto;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.toubutu.audio.common.QueryBaseDto;
import com.toubutu.audio.entity.Comment;
import com.toubutu.constants.BaseConstants;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;

import javax.validation.Valid;

/**
 * @author 朱鹏杰
 * @version 1.0
 * @date 2024年02月28日 11:40
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class PageQueryCommentDto extends QueryBaseDto<Comment> {
    private String videoCode;
    private Integer parentId;
    @Override
    public LambdaQueryWrapper<Comment> getWrapper() {
        LambdaQueryWrapper<Comment> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Comment::getIsDelete,BaseConstants.UN_DELETED);
        if (StringUtils.isNotBlank(videoCode)){
            queryWrapper.eq(Comment::getVideoCode, videoCode);
        }
        queryWrapper.eq(Comment::getParentId,parentId==null? BaseConstants.PARENT_MENU_ID:parentId);
        return queryWrapper;
    }
}
